<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::ScalarQuantizer Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1ScalarQuantizer.html">ScalarQuantizer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1ScalarQuantizer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::ScalarQuantizer Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="IndexScalarQuantizer_8h_source.html">IndexScalarQuantizer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer_1_1DistanceComputer.html">DistanceComputer</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a1201dbd1611fa5c10782ade5d0e4952e"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952e">QuantizerType</a> { <a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952ea1650389e3efa052ff60177d502328a2c">QT_8bit</a>, 
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952eacd3d1bd71533a7bc52149e4b3d1db13b">QT_4bit</a>, 
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952ea029f07a15ea64e7e73daaf9633ac429a">QT_8bit_uniform</a>, 
<b>QT_4bit_uniform</b>
 }</td></tr>
<tr class="separator:a1201dbd1611fa5c10782ade5d0e4952e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a867ad0000e4ccfd40bbb1e01e7882d06"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06">RangeStat</a> { <a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06aa52f2f14616c61c04baf6323d43588fd">RS_minmax</a>, 
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06afb4b9f4ee9003fa0193e6de69632f7a0">RS_meanstd</a>, 
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06ae41cccec3a7acbcb3a47fa63c2bfb4c8">RS_quantiles</a>, 
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06ab0709ff74c1b882b64a7fdd7ca5df9a3">RS_optim</a>
 }</td></tr>
<tr class="separator:a867ad0000e4ccfd40bbb1e01e7882d06"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa49b6ffd5a6b8a0029bc85ed5fa9504c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa49b6ffd5a6b8a0029bc85ed5fa9504c"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ScalarQuantizer</b> (size_t <a class="el" href="structfaiss_1_1ScalarQuantizer.html#acd88af01ad1d06560cecc30bc38aef49">d</a>, <a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952e">QuantizerType</a> qtype)</td></tr>
<tr class="separator:aa49b6ffd5a6b8a0029bc85ed5fa9504c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1f21830fd85d5119cc36ee13fd1a92b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af1f21830fd85d5119cc36ee13fd1a92b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>train</b> (size_t n, const float *x)</td></tr>
<tr class="separator:af1f21830fd85d5119cc36ee13fd1a92b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2bccf276565c4f80fed3d0c715c58816"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2bccf276565c4f80fed3d0c715c58816"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a2bccf276565c4f80fed3d0c715c58816">compute_codes</a> (const float *x, uint8_t *codes, size_t n) const </td></tr>
<tr class="memdesc:a2bccf276565c4f80fed3d0c715c58816"><td class="mdescLeft">&#160;</td><td class="mdescRight">same as compute_code for several vectors <br/></td></tr>
<tr class="separator:a2bccf276565c4f80fed3d0c715c58816"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ab9e9158da1777d45e6f9bf73bfd489"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7ab9e9158da1777d45e6f9bf73bfd489"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a7ab9e9158da1777d45e6f9bf73bfd489">decode</a> (const uint8_t *code, float *x, size_t n) const </td></tr>
<tr class="memdesc:a7ab9e9158da1777d45e6f9bf73bfd489"><td class="mdescLeft">&#160;</td><td class="mdescRight">decode a vector from a given code (or n vectors if third argument) <br/></td></tr>
<tr class="separator:a7ab9e9158da1777d45e6f9bf73bfd489"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55399b762c9cc6169ee19d293470c6cd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a55399b762c9cc6169ee19d293470c6cd"></a>
<a class="el" href="structfaiss_1_1ScalarQuantizer_1_1DistanceComputer.html">DistanceComputer</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>get_distance_computer</b> (<a class="el" href="namespacefaiss.html#afd12191c638da74760ff397cf319752c">MetricType</a> metric=METRIC_L2) const </td></tr>
<tr class="separator:a55399b762c9cc6169ee19d293470c6cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a2696491a09e0ad3bbf48506592fb69de"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2696491a09e0ad3bbf48506592fb69de"></a>
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952e">QuantizerType</a>&#160;</td><td class="memItemRight" valign="bottom"><b>qtype</b></td></tr>
<tr class="separator:a2696491a09e0ad3bbf48506592fb69de"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aea7d3bd87a6c82292aed03fcb7e5e265"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aea7d3bd87a6c82292aed03fcb7e5e265"></a>
<a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06">RangeStat</a>&#160;</td><td class="memItemRight" valign="bottom"><b>rangestat</b></td></tr>
<tr class="separator:aea7d3bd87a6c82292aed03fcb7e5e265"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacac5a2655b0dbf5d828dde8ab236b48"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aacac5a2655b0dbf5d828dde8ab236b48"></a>
float&#160;</td><td class="memItemRight" valign="bottom"><b>rangestat_arg</b></td></tr>
<tr class="separator:aacac5a2655b0dbf5d828dde8ab236b48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd88af01ad1d06560cecc30bc38aef49"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd88af01ad1d06560cecc30bc38aef49"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#acd88af01ad1d06560cecc30bc38aef49">d</a></td></tr>
<tr class="memdesc:acd88af01ad1d06560cecc30bc38aef49"><td class="mdescLeft">&#160;</td><td class="mdescRight">dimension of input vectors <br/></td></tr>
<tr class="separator:acd88af01ad1d06560cecc30bc38aef49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a647b8774e4cd8ca5623a194f5c7f8a33"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a647b8774e4cd8ca5623a194f5c7f8a33"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a647b8774e4cd8ca5623a194f5c7f8a33">code_size</a></td></tr>
<tr class="memdesc:a647b8774e4cd8ca5623a194f5c7f8a33"><td class="mdescLeft">&#160;</td><td class="mdescRight">bytes per vector <br/></td></tr>
<tr class="separator:a647b8774e4cd8ca5623a194f5c7f8a33"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30b411b10780a74079bbbfaff678c86f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a30b411b10780a74079bbbfaff678c86f"></a>
std::vector&lt; float &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ScalarQuantizer.html#a30b411b10780a74079bbbfaff678c86f">trained</a></td></tr>
<tr class="memdesc:a30b411b10780a74079bbbfaff678c86f"><td class="mdescLeft">&#160;</td><td class="mdescRight">trained values (including the range) <br/></td></tr>
<tr class="separator:a30b411b10780a74079bbbfaff678c86f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The uniform quantizer has a range [vmin, vmax]. The range can be the same for all dimensions (uniform) or specific per dimension (default). </p>

<p>Definition at line <a class="el" href="IndexScalarQuantizer_8h_source.html#l00030">30</a> of file <a class="el" href="IndexScalarQuantizer_8h_source.html">IndexScalarQuantizer.h</a>.</p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="a1201dbd1611fa5c10782ade5d0e4952e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="structfaiss_1_1ScalarQuantizer.html#a1201dbd1611fa5c10782ade5d0e4952e">faiss::ScalarQuantizer::QuantizerType</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="a1201dbd1611fa5c10782ade5d0e4952ea1650389e3efa052ff60177d502328a2c"></a>QT_8bit</em>&nbsp;</td><td class="fielddoc">
<p>8 bits per component </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a1201dbd1611fa5c10782ade5d0e4952eacd3d1bd71533a7bc52149e4b3d1db13b"></a>QT_4bit</em>&nbsp;</td><td class="fielddoc">
<p>4 bits per component </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a1201dbd1611fa5c10782ade5d0e4952ea029f07a15ea64e7e73daaf9633ac429a"></a>QT_8bit_uniform</em>&nbsp;</td><td class="fielddoc">
<p>same, shared range for all dimensions </p>
</td></tr>
</table>

<p>Definition at line <a class="el" href="IndexScalarQuantizer_8h_source.html#l00032">32</a> of file <a class="el" href="IndexScalarQuantizer_8h_source.html">IndexScalarQuantizer.h</a>.</p>

</div>
</div>
<a class="anchor" id="a867ad0000e4ccfd40bbb1e01e7882d06"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="structfaiss_1_1ScalarQuantizer.html#a867ad0000e4ccfd40bbb1e01e7882d06">faiss::ScalarQuantizer::RangeStat</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The uniform encoder can estimate the range of representable values of the unform encoder using different statistics. Here rs = rangestat_arg </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="a867ad0000e4ccfd40bbb1e01e7882d06aa52f2f14616c61c04baf6323d43588fd"></a>RS_minmax</em>&nbsp;</td><td class="fielddoc">
<p>[min - rs*(max-min), max + rs*(max-min)] </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a867ad0000e4ccfd40bbb1e01e7882d06afb4b9f4ee9003fa0193e6de69632f7a0"></a>RS_meanstd</em>&nbsp;</td><td class="fielddoc">
<p>[mean - std * rs, mean + std * rs] </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a867ad0000e4ccfd40bbb1e01e7882d06ae41cccec3a7acbcb3a47fa63c2bfb4c8"></a>RS_quantiles</em>&nbsp;</td><td class="fielddoc">
<p>[Q(rs), Q(1-rs)] </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a867ad0000e4ccfd40bbb1e01e7882d06ab0709ff74c1b882b64a7fdd7ca5df9a3"></a>RS_optim</em>&nbsp;</td><td class="fielddoc">
<p>alternate optimization of reconstruction error </p>
</td></tr>
</table>

<p>Definition at line <a class="el" href="IndexScalarQuantizer_8h_source.html#l00046">46</a> of file <a class="el" href="IndexScalarQuantizer_8h_source.html">IndexScalarQuantizer.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following files:<ul>
<li>/data/users/matthijs/github_faiss/faiss/<a class="el" href="IndexScalarQuantizer_8h_source.html">IndexScalarQuantizer.h</a></li>
<li>/data/users/matthijs/github_faiss/faiss/<a class="el" href="IndexScalarQuantizer_8cpp_source.html">IndexScalarQuantizer.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
